﻿//------------------------------------------------------------------------------
// <copyright file="RpcErrorEventArgs.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//------------------------------------------------------------------------------

namespace Microsoft.Internal.GamesTest.Rpc.Client
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    /// <summary>
    /// This class contains all of the data available when an unexpected error occurs on the RpcChannel.
    /// </summary>
    public class RpcErrorEventArgs : EventArgs
    {
        /// <summary>
        /// Initializes a new instance of the RpcErrorEventArgs class.
        /// </summary>
        /// <param name="message">A message describing the error scenario.</param>
        /// <param name="failedIncomingMessage">Optional.  The incoming message that was received that generated the error.</param>
        /// <param name="ex">Optional.  An exception that led to the error.</param>
        internal RpcErrorEventArgs(string message, string failedIncomingMessage, Exception ex)
        {
            this.Message = message;
            this.FailedIncomingMessage = failedIncomingMessage;
            this.Exception = ex;
        }

        /// <summary>
        /// Gets a message describing the error scenario.
        /// </summary>
        public string Message { get; private set; }

        /// <summary>
        /// Gets the optional incoming message that was received and generated the error.
        /// </summary>
        public string FailedIncomingMessage { get; private set; }

        /// <summary>
        /// Gets the optional exception that lead to the error.
        /// </summary>
        public Exception Exception { get; private set; }
    }
}
